<template>
  <div class="chart-container">
    <div class="chart-header">
      <div class="chart-title" v-if="title">{{ title }}</div>
      <div class="chart-icon"></div>
    </div>
    <div class="chart-content">
      <slot></slot>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  name: "ChartContainer",
  props: {
    title: {
      type: String,
      default: "",
    },
  },
});
</script> 

<style scoped>
.chart-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 10px;
  position: relative;
  background-color: transparent;
  border: none;
  overflow: hidden;
  background-image: url('/line.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  position: relative;
  height: 40px;
  min-height: 40px;
}

.chart-header::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    to right,
    rgba(0, 183, 255, 0),
    rgba(0, 183, 255, 0.6),
    rgba(0, 183, 255, 0)
  );
}

.chart-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(0, 183, 255, 0.8);
  box-shadow: 0 0 8px rgba(0, 183, 255, 0.8);
  animation: pulse 2s infinite;
}

.chart-title {
  font-size: 18px;
  color: #fff;
  text-align: center;
  margin-bottom: 0;
  font-weight: bold;
  letter-spacing: 1px;
  position: relative;
  display: inline-block;
}

.chart-content {
  flex: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: 250px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 183, 255, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(0, 183, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 183, 255, 0);
  }
}
</style>